﻿using System;
using System.ServiceModel;
using ExplorerService.Common.DataContracts.Operations;

namespace ExplorerService.Common.ServiceContracts
{
    [ServiceContract(SessionMode = SessionMode.Required, CallbackContract = typeof(IClientOperationServiceCallback))]
    public interface IClientOperationService
    {
        /// <summary>
        /// Starts the operation session by registering with the session manager
        /// </summary>
        /// <param name="sessionId"></param>
        [OperationContract(IsInitiating = true, IsTerminating = false)]
        void StartOperationSession(Guid sessionId);

        /// <summary>
        /// Cancels an operation
        /// </summary>
        /// <param name="operationId"></param>
        [OperationContract(IsInitiating = true, IsTerminating = true)]
        void CancelOperation(Guid operationId);

        /// <summary>
        /// Posts a new operation to be performed by an application
        /// </summary>
        [OperationContract(IsInitiating = false, IsTerminating = false)]
        bool PostOperation(Operation operation);

        /// <summary>
        /// Ends the current operation session
        /// </summary>
        [OperationContract(IsInitiating = false, IsTerminating = true)]
        void EndOperationSession();

    }
}
